cmake_minimum_required(VERSION 3.5)

project(PreviewClipboard LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets DBus REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets DBus Concurrent REQUIRED)

set(PROJECT_SOURCES
        main.cpp
        mainwindow.cpp
        mainwindow.h
)

if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
    qt_add_executable(PreviewClipboard
        ${PROJECT_SOURCES}
    )
else()
    if(ANDROID)
        add_library(PreviewClipboard SHARED
            ${PROJECT_SOURCES}
        )
    else()
        add_executable(PreviewClipboard
            ${PROJECT_SOURCES}
        )
    endif()
endif()

target_link_libraries(PreviewClipboard PRIVATE
    Qt${QT_VERSION_MAJOR}::Widgets
)

add_subdirectory(manager)
